<%@page import="com.web.entity.TestBiao"%>
<%@page errorPage="Submiterror.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <base href="${pageContext.request.contextPath}/">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Send Test To Student</title>
        <link rel="stylesheet" href="css/bootstrap.min.css"/>
        <link rel="stylesheet" href="css/style.css"/>
        <link rel="stylesheet" href="css/newcss1.css">
        <link rel="stylesheet" href="css/mycss_foradim.css"/>
        <script src="js/jquery-3.4.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script type="text/javascript" src="js/circle.js" charset="UTF-8"></script>
    </script>
    <body>
        
    <div id="navdiv">
            <div class="top_navdiv">
                <div class="top_left">教师中心</div>
                <div class="identity">
                    <span>您好</span>
                    <div class="user_li">
                        <canvas id="myCanvas" width="100" height="30">
                        </canvas>
                    </div>
                </div>
            </div>
        </div>
        <div class="navbar  control_nav" >
            <div class="container"  style="margin-left: 300px; ">
                <ul class="nav navbar-nav navul">
                    <li class="col-md-2">
                        <a href="teacherApplyTest.jsp">申请/取消考试</a>
                    </li>
                    <li class="col-md-2">
                        <input type="hidden" name="ClassID" class="form-control" >
                        <a href="ssls">查看班级列表</a>
                    </li>
                    <li class="col-md-2">
                        <a href="SearchOneStudent.html">查询单个学生</a>
                    </li>
                    <li class="col-md-2">
                        <a href="sosgs">查询学生成绩</a>
                    </li>
                    <li class="col-md-2">
                        <a href="scgs">查询班级成绩</a>
                    </li>
                </ul>
            </div>
        </div>
        <script> 
    $(document).ready(function () {
    //点击发送考试链接给学生，到ApplyTestServlet,提交考试信息
    $("#btn_apply").click(function(){
        $.ajax({
            url:"addSS",
            type:"POST",
            data: $("#send").serialize(),
            success: function(rows){
                alert("发送成功！");
                if(rows!=1){
                    alert("添加失败！");
                    return;
                }
                
                var str="<tr id=\"tr"+$("#send #tid").val()+"\">"
                        +"<td>"+$("#send #classid").val()+"</td>"
                        +"<td>"+$("#send #courseid").val()+"</td>"
                        +"<td>"+$("#send #tid").val()+"</td>"
                        +"</tr>";
                
            },
            error: function(){
                alert("请求处理出错，添加失败！");
            }
        });
    });
});
        </script>
        <%
            TestBiao tb = (TestBiao) session.getAttribute("teststatus");
        %>
        <form id="send">
        &nbsp;&nbsp;<input type="hidden" name="classid" id="classid" class="form-control" value="<%=tb.getClassid() %>" style="width: 50px; margin-left: 730px;margin-top: -35px;" readonly> 
        &nbsp;&nbsp;<input type="hidden" name="courseid" id="courseid" class="form-control" value="<%=tb.getCourseid() %>" style="width: 50px; margin-left: 730px;margin-top: -35px;" readonly> 
        &nbsp;&nbsp;<input type="hidden" name="tid" id="tid" class="form-control" value="<%=tb.getTid() %>" style="width: 50px; margin-left: 730px;margin-top: -35px;" readonly> 
        <p style="margin-left: 500px; font-size: 30px;">管理员已通过您的考试申请！请发送考试！</p><br>
        <button type="submit" id="btn_apply" class="btn btn-sm btn-primary" style="background-color: #0066cc;color: #ffffff;width: 250px; margin-left: 630px;margin-top: -10px; border-radius: 4px 4px 4px 4px; font-size: 13px;">发送考试链接给学生</button>
        
        </form>
        </body>
</html>